<template>
  <div class="login-box">
    <el-card class="login-card">
      <h3>用 户 登 录</h3>
      <div class="info">
        <el-input v-model="username" placeholder="请输入你的用户名" clearable class="input"></el-input>
        <el-input v-model="password" placeholder="请输入你的密码" show-password class="input"></el-input>
        <el-button type="primary" class="btn" @click="userLogin">登录</el-button>
      </div>
    </el-card>

  </div>
</template>

<script>
export default {
  name: 'login',
  data() {
    return {
      username: 'admin',
      password: '123456'
    }
  },
  methods: {
    userLogin() {
      if (this.username && this.password != null) {
        this.$router.replace('/index/home')
        this.$message({
          message: '登录成功',
          type: 'success'
        })
      } else {
        this.$message.error('请正确输入你的用户名和密码')
      }
    }
  }

}
</script>

<style lang="less" scoped>
.login-box {
  height: 100%;
  background: rgb(58, 58, 162);
  display: flex;
  justify-content: center;
  align-items: center;
  .login-card {
    width: 500px;
    height: 350px;
    text-align: center;
    h3 {
      padding-bottom: 10px;
      border-bottom: 1px solid rgb(99, 99, 99);
    }
    .info {
      margin-top: 50px;
      .input {
        margin-bottom: 10px;
        width: 300px;
      }
      .btn {
        width: 300px;
      }
    }
  }
}
</style>
